<template>
    <el-form label-position="top">
        <el-form-item label="">
            将 <b>{{ playerId }}</b> 的 <b>身份证 / 手机号码 / 注册IP / 设备码</b> 加入黑名单库.
            <br>
            拉黑后不影响当前玩家.
            <br>
            <span class="color-danger size-12">此操作不可逆, 请谨慎操作.</span>
        </el-form-item>
        <el-form-item label="">
            <el-input type="textarea" :autosize="{minRows: 3}" v-model="form.remark" placeholder="备注一下吧"/>
        </el-form-item>
        <el-form-item class="text-right">
            <el-button type="primary" :loading="loading" @click="submit">确定</el-button>
            <el-button @click="cancel">取消</el-button>
        </el-form-item>
    </el-form>
</template>

<script>
export default {
    name: "dialog-add-blacklist",
    props: {
        playerId: '',
    },
    data () {
        return {
            loading: false,
            form: {
                remark: '',
            }
        }
    },
    methods: {
        submit() {
            this.loading = true;
            let form = this.$helper.deepClone(this.form);
            form.playerId = this.playerId;
            this.$store.dispatch('user/AddBlacklist', form).then(({data}) => {
                this.$message.success(data.message);

                this.reset();
                this.$emit('submit');
            }).finally(() => {
                this.loading = false;
            })
        },
        cancel() {
            this.$emit('cancel');
        },
        reset() {
            this.form.remark = '';
        }
    },
    created() {

    },
}
</script>

<style scoped>

</style>
